home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / COM / LineShare 3.3.1 folder.sit / LineShare 3.3.1 folder / LineShare 3.3.1 / LineShare Scripts / Telebit 2500 ARA&Data < prev    next >
Text File  |  1994-02-10  |  5KB  |  244 lines

  1. !$ Version 2.1
  2. !$ Requires: Telebit 2500 modem
  3.  
  4. !$ Supports: ARA and a generic comm. software (QuickMail, BBS, etc) in the server mode.
  5.  
  6. !$ For ARA use:  ARA/LineShare script.
  7. !$ For Data use: generic settings (if Apple Modem Tool is used,
  8. !$ remove all register settings using the Customノ option).
  9.  
  10. ^2 Speaker On:        = Enum("Never" = "0" ,  "When Connecting" = "1", "Always"="2") "1"
  11. ^3 Speaker Volume:    = Enum("Low"="50","Medium"="150","High"="250") "150"
  12. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  13. ^5 Max Port Speed:    = Enum("9600","19200","38400") "19200"
  14.  
  15. ! ------------------------------------------
  16. ! Resetting the modem:
  17. ! ------------------------------------------
  18. @Hangup
  19.   SetTries 2
  20.   Flush
  21.   HsReset 0,0,17,19,0,0
  22. !
  23. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  24. ! to enter the command mode
  25. !
  26. @Label 1
  27.   matchclr
  28.   matchstr 1 2 "OK¥r¥n"
  29.   Sbreak
  30.   write "ATH0&F¥r"
  31.   matchread 20
  32.   ChrDelay 1
  33.   Write "+++"
  34.   ChrDelay 0
  35.   DtrClear
  36.   pause 10
  37.   DtrSet
  38. !
  39.   DecTries
  40. ! SerReset 19200,0,8,1
  41.   IfTries 0 1
  42. !
  43. ! OSErr -6019 "Modem error - the modem is not responding"
  44. !
  45.   exit -6019
  46. @Label 2
  47.   exit 0
  48. ! ------------------------------------------
  49. !    Receiving incoming calls
  50. ! ------------------------------------------
  51. @ANSWER
  52. @Label 10
  53.   SerReset Val("^5"),0,8,1
  54.   Jsr 80
  55. !
  56. ! Set the common options
  57.   Jsr 70
  58.  
  59. !
  60. ! Tell the modem to determine the type of the incoming call
  61. ! Fetch the tube after ^4 rings
  62. !
  63.   Write "ATS0=^4¥r"
  64.   Jsr 100
  65.   Note "Waiting for ARA/Data callsノ"
  66. !
  67. ! Everything is ready - let's sit and wait for a call
  68. ! We'll wait for 2 minutes, then reinitiate the modem
  69. !
  70. @Label 12
  71.   MatchClr
  72.   matchstr 1 13 "RING¥r¥n"
  73.   matchstr 2 21 "¥r¥nCONNECT ^$/"
  74.   matchstr 3 15 "¥r¥nCONNECT ^$¥r¥n"
  75.   matchstr 10 10 "¥r¥nNO "
  76.   matchstr 11 10 "¥r¥nBUSY"
  77.   Matchread 1200
  78.   Jump 10
  79. @Label 13
  80.   Note "Ringノ"
  81.   Jump 12
  82. !
  83. ! Data connection has been established (we read "CONNECT XXX¥r¥n")
  84. ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
  85. ! if it was an incoming call, put the "RING" before the "CONNECT"
  86. !
  87. @Label 15
  88.   SetVar A "^$"
  89.   IfStr A 17 "FAST"
  90. @Label 16
  91.   Note "Non-V.42 Call at ^A bps. Waiting for an ARA frame."
  92.   MatchClr
  93.   MatchStr 1 20 "¥r"
  94.   MatchStr 2 30 "¥08¥01¥03¥14¥04¥03¥00¥08¥250¥16¥03"
  95.   MatchRead 40
  96.  
  97. @Label 20
  98.   Note "Non-ARA call"
  99.   Jump 24
  100.  
  101. @Label 17
  102.   SetVar A "19200"
  103.   Jump 16
  104. !
  105. ! V.42 call detected
  106. !
  107. @Label 21
  108.   SetVar A "^$"
  109.   Note "V.42 Call at ^A bps"
  110.   MatchClr
  111.   MatchStr 1 24 "¥r¥n"
  112.   MatchRead 5
  113. @Label 24
  114.   QueueInput "¥r¥nRING¥r¥n¥r¥nCONNECT ^A¥r¥n"
  115. @Label 25
  116.   Attach "Data" (DTR,Escape,TimeLimit=0)
  117.  
  118. !
  119. ! The ARA (MNP 4) frame detected
  120. !
  121. @Label 30
  122.   Note "ARA call at ^A bps."
  123.   Flush
  124.   QueueInput "^A¥r¥n"
  125. @Label 31
  126.   QueueInput "¥r¥nCARRIER "
  127. @Label 35
  128.   ifOriginate 36
  129.   QueueInput "¥r¥nRING¥r¥n"
  130. @Label 36
  131.   Attach "ARA" (DTR,Escape,TimeLimit=0)
  132.  
  133. ! ------------------------------------------
  134. ! Originating a call through the "ARA" subport
  135. ! ------------------------------------------
  136. @ORIGINATE "ARA"
  137.   SerReset Val("^5"),0,8,1
  138.   Jsr 80
  139. !
  140. ! Set the common options
  141. !
  142.   Jsr 70
  143. !
  144. ! Prepare to receive all error result codes
  145. !
  146.   Jsr 90
  147.   MatchStr 1 31 "¥r¥nCONNECT "
  148.   MatchRead 900
  149.   Write "¥r"
  150.   Exit -6019
  151.  
  152. ! ------------------------------------------
  153. ! Originating a call through the "Data" subport
  154. ! ------------------------------------------
  155. @ORIGINATE "Data"
  156.   SerReset Val("^5"),0,8,1
  157.   Jsr 80
  158.   Jsr 70
  159. !
  160. ! Now emit all commands that the application has sent to that port
  161. !
  162.   Jsr 60
  163.   SerReset *
  164.   Jsr 80
  165. !
  166. ! Prepare to receive all error result codes
  167. !
  168.   Flush
  169.   Jsr 90
  170.   MatchStr 1 48 "^$¥r¥nCONNECT"
  171.   MatchRead 900
  172.   Write "¥r"
  173.   Exit -6019
  174. @Label 48
  175.   QueueInput "^$¥r¥nCONNECT"
  176.   Jump 25
  177.  
  178. !
  179. ! This section emits all modem commands sent from the client application
  180. ! For each set of commands the "OK" answer is awaited
  181. !
  182. @Label 60
  183.   EmitStart
  184. @Label 61
  185.   EmitCommand 62
  186.   Jsr 100
  187.   Jump 61
  188. @Label 62
  189.   return
  190. !
  191. ! This section initiates the modem before ANSWER and ORIGINATEs:
  192. !
  193. @Label 70
  194.   Write "AT~&FM^2S61=^3V1E0¥r"
  195.   Jsr 100
  196.   Write "AT S58=2 S66=1 S68=2 S92=1 S95=0 S97=1 S106=1¥r"
  197.   Jsr 100
  198.   return 
  199. !
  200. ! This section syncronize the modem after the serial port speed switching
  201. !
  202. @Label 80
  203.   ChrDelay 1
  204.   Write "AT¥r"
  205.   ChrDelay 0
  206.   Jsr 100
  207.   return
  208. !
  209. ! Prepare to receive error result codes
  210. !
  211. @Label 90
  212.   MatchClr
  213.   MatchStr 2 91 "NO DIALTONE¥r¥n"
  214.   MatchStr 3 92 "BUSY¥r¥n"
  215.   MatchStr 4 93 "NO CARRIER¥r¥n"
  216.   MatchStr 5 94 "NO ANSWER¥r¥n"
  217.   Write "ATD^1¥r"
  218.   HsReset *
  219.   return
  220.  
  221. @Label 91
  222.   exit -6020
  223. @Label 92
  224.   exit -6022
  225. @Label 93
  226.   exit -6021
  227. @Label 94
  228.   exit -6023
  229. !
  230. ! Processing the AT command:
  231. ! OK -> proceed
  232. ! ERROR or TimeOut ->exit -6019
  233. ! It can be called AFTER the "Write" command, since LineShare buffers input
  234. !
  235. @Label 100
  236.   MatchClr
  237.   MatchStr 1 102 "¥r¥nOK¥r¥n"
  238.   MatchStr 2 101 "¥r¥nERROR¥r¥n"
  239.   MatchRead 20
  240. @Label 101
  241.   Exit -6019
  242. @Label 102
  243.   return
  244.